<?php
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die();

class DetaiHelper {
	
	function alias($text) {
		$arr_u = array('ú','ủ','ụ','ũ','ù','ư','ứ','ử','ự','ữ','ừ','Ú','Ủ','Ụ','Ũ','Ù','Ư','Ứ','Ử','Ự','Ữ','Ừ');
		$arr_e = array('é','ẻ','ẹ','ẽ','è','ê','ế','ể','ệ','ễ','ề','É','Ẻ','Ẹ','Ẽ','È','Ê','Ế','Ể','Ệ','Ễ','Ề');
		$arr_i = array('í','ỉ','ị','ĩ','ì','Í','Ỉ','Ị','Ĩ','Ì');
		$arr_y = array('ý','ỷ','ỵ','ỹ','ỳ','Ý','Ỷ','Ỵ','Ỹ','Ỳ');
		$arr_a = array('á','ả','ạ','ã','à','â','ấ','ẩ','ậ','ẫ','ầ','ă','ắ','ẳ','ặ','ẵ','ằ','Á','Ả','Ạ','Ã','À','Â','Ấ','Ẩ','Ậ','Ẫ','Ầ','Ă','Ắ','Ẳ','Ặ','Ẵ','Ằ');
		$arr_o = array('ó','ỏ','ọ','õ','ò','ô','ố','ổ','ộ','ỗ','ồ','ơ','ớ','ở','ợ','ỡ','ờ','Ó','Ỏ','Ọ','Õ','Ò','Ô','Ố','Ổ','Ộ','Ỗ','Ồ','Ơ','Ớ','Ở','Ợ','Ỡ','Ờ');
		$arr_d = array('Đ','đ');
		$arr_ = array('_',' ');
		
		//$text = strtolower($text);
		$text = str_replace($arr_u,'u',$text);
		$text = str_replace($arr_e,'e',$text);
		$text = str_replace($arr_i,'i',$text);
		$text = str_replace($arr_y,'y',$text);
		$text = str_replace($arr_a,'a',$text);
		$text = str_replace($arr_o,'o',$text);
		$text = str_replace($arr_d,'d',$text);
		$text = str_replace($arr_,'-',$text);
		
		return strtolower($text);		
	}
	
	function nghiemthu($index=0) {
		$data = array(
			0=>'chưa xác định',
			1=>'xuất sắc',
			2=>'khá',
			3=>'trung bình',
			4=>'không đạt'
		);
		if ($index) {
			return $data[$index];
		} else {
			return $data;
		}		
	}
	
	function nghiemthuRadio($selected=0) {
		$nghiemthu = DetaiHelper::nghiemthu();
		$data = array();
		foreach ($nghiemthu as $key=>$value) {
			$data[] = JHTML::_('select.option', $key, $value);
		}
		return JHTML::_('select.genericlist', $data,'nghiemthu', 'class="inputbox"', 'value', 'text',$selected);
	}
	
	
}